@echo off
call config.bat


echo *** Creating directories ***
mkdir %TMPRES%
mkdir %BIN%

echo *** Build Data ***

cd %TOOLS_PATH%
call copy_files.bat %RES% %TMPRES%

cd %TMPRES%
rem pack text
for %%i in (*.text) do (
	%J2SE_DIR%\bin\java -jar %TEXT_PACK%	%%i		%%i.bin 	UNICODE 	%SRC_DIR_H%\%%i.h
)

rem pack animation
for %%i in (*.anim) do (
	%J2SE_DIR%\bin\java -jar %ANIM_PACK% 	%%i		%%~ni.banim		QUALITY_TRUE_COLOR	EXPORT_AS_3D_TEXTURE	OPTIMIZE_MODULE_SIZE PIXEL_32BITS EXPORT_FMODULE_OPACITY USE_MULTI_MODULE_TYPE
)
rem call custom build scripts if exist
for %%i in (*.bat) do (
	call %%i
)

rem pack binary all to lib
%J2SE_DIR%\bin\java -jar %LIB_PACK%		%TMPRES%\lib.manifest 	%BIN%	CPP_BIN		%SRC_DIR_H%\ResourceManifest.h	%SRC_DIR_CPP%\ResourceManifest.cpp	%BIN%\rm

rem copy all generated src code to src dir
copy *.h %SRC_DIR_H%

rem del /Q *.*
cd %PRJ_DIR%
rem rd %TMPRES%

echo *** Building Data Complete ***

pause